{include file="public/header" /}
<div id="dcWrap">
    <div id="dcMain">
        <!-- 当前位置 -->
        <div id="urHere">管理中心<b>></b><strong>公告管理</strong></div>
        <div id="manager" class="mainBox" style="height:auto!important;height:550px;min-height:550px;">
       <!--  {:url('flink/add')} -->
            <h3><a href="javascript:;" class="actionBtn">添加公告</a>公告管理</h3>
            <table width="100%" border="0" cellpadding="8" cellspacing="0" class="tableBasic">
                <tr>
                    <th width="30" align="center">编号</th>
                    <th align="left">公告标题</th>
                    <th align="left">图片</th>
                    <th align="center">公告内容</th>
                    <th align="center">创建时间</th>
                    <th align="center">操作</th>
                </tr>
                {volist name="list" id="vo"}
                <tr>
                    <td align="center">{$vo.id}</td>
                    <td>{$vo.title}</td>
                    <td align="center">{if condition="$vo['logo'] neq ''"}<img src='{$vo.logo}' width="50px" height="50px" />{/if}</td>
                    <td align="center">{$vo.description|mb_substr=0,30}</td>
                    <td align="center">{$vo.create_time|date='Y-m-d H:i:s'}</td>
                    <td align="center"><a data-url="{:url('flink/edit',['id' => $vo.id, 'type' => 2])}" class="btn btn-info edit-flink">编 辑</a>  <a class="del btn btn-danger" data-id="{$vo['id']}">删 除</a></td>
                </tr>
                {/volist}
            </table>
            <div class="pager">{$page|raw}</div>
        </div>
    </div>
    <div class="clear"></div>
    {include file="public/footer" /}
    <div class="clear"></div>
</div>
<script type="text/javascript">
    $('.actionBtn').click(function(){
        layer.open({
          title: '添加公告',
          type: 2,
          area: ['700px', '530px'],
          fixed: false, //不固定
          maxmin: true,
          content: 'add?type=2'
        });
    });
    $('.edit-flink').click(function(){
        var url = $(this).data('url');
        layer.open({
          title: '修改公告',
          type: 2,
          area: ['700px', '530px'],
          fixed: false, //不固定
          maxmin: true,
          content: url
        });
    });
    //删除
    $(".del").click(function(){
        var id= $(this).data('id');
        var $this = $(this).parents('tr');
        confirms('','是否确认删除编号为【'+ id +'】的友链？','',function(){
            $.get("{:url('flink/dele')}",{id:id},function(data){
                layer.msg(data.msg,{time: 1000}, function(){
                    if (data.status == 1) {
                        $this.remove();
                    }
                });
            },'json');
        });
    })
</script>
</body>
</html>